#!/usr/bin/env python 
# coding:utf-8
# @Time :10/18/18 17:14

import sys

from common.mongo import MongDb
from config.conf import MONGO_DB_WEBPAGE_CONF, COMPANY_DATA_DB_CONF
from logger import AppLogger

length = len(sys.argv)
# 判断是否是在debug模式下
if length > 0:
    is_debug = False
else:
    is_debug = True

# 判断是否可以通过省份进行区分log
if length >= 4:
    log_name = 'start_parse_task_' + sys.argv[3] + '.log'
else:
    log_name = 'start_parse_task.log'

global_logger = AppLogger(log_name)
global_log = global_logger.get_logger()

# 新网页库
WEBPAGE_DB = MongDb(MONGO_DB_WEBPAGE_CONF['host'], MONGO_DB_WEBPAGE_CONF['port'], MONGO_DB_WEBPAGE_CONF['db'],
                        MONGO_DB_WEBPAGE_CONF['username'],
                        MONGO_DB_WEBPAGE_CONF['password'], log=global_log)

company_data_db = MongDb(COMPANY_DATA_DB_CONF['host'], COMPANY_DATA_DB_CONF['port'], COMPANY_DATA_DB_CONF['db'],
                         COMPANY_DATA_DB_CONF['username'], COMPANY_DATA_DB_CONF['password'], log=global_log)
